package cj.web.kly.service;
/*
 *  
 *  
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cj.web.kly.domain.News;
import cj.web.kly.dao.NewsDAO;

/**
 * 
 * @author 
 *
 */
@Service
public class NewsService{

	@Autowired
    private NewsDAO newsDAO;
	
	/**
	 * 查询
	 * @param news
	 * @return newslis;size
	 */
	public Map query(News news){
		Map rep = new HashMap();
		List<News> newslis = newsDAO.query(news);
		int size = newsDAO.querySize(news); 
		rep.put("newslis", newslis);
		rep.put("size", size);
		return rep;
    }
	
	/**
	 * 查询
	 * @param news
	 * @return newslis;size
	 */
	public Map queryBB(News news){
		Map rep = new HashMap();
		List<News> newslis = newsDAO.queryBB(news);
		int size = newsDAO.queryBBSize(news); 
		rep.put("newslis", newslis);
		rep.put("size", size);
		return rep;
    }
	
	public News queryById(int id){
		News obj = newsDAO.queryById(id);
		return obj;
    }
	
	public void create(News news){
		newsDAO.create(news);
	}
	
	public void update(News news){
		newsDAO.update(news);
	}
	
	public void deleteById(int id){
		newsDAO.deleteById(id);
	}
	
	public void updateByStickTime(int id){
		newsDAO.updateByStickTime(id);
	}
	
	public void updateByStickTimeIsNull(int id){
		newsDAO.updateByStickTimeIsNull(id);
	}
	
	public void updatePV(int id,int pvNum){
		newsDAO.updatePV(id,pvNum);
	}
	
	public void updateReleaseStateById(int id,int releaseState){
		newsDAO.updateReleaseStateById(id,releaseState);
	}
	
	public void updateByIsTop(int id){
		newsDAO.updateByIsTop(id);
	}
	
	public void updateByIsNotTop(int id){
		newsDAO.updateByIsNotTop(id);
	}
}